
<div style="height:217px; width:640px; position:relative;">
  <script type="text/javascript">
    timeout = 60000; // update interval in ms
  
    function GetXmlHttpObject()
		{
			var xmlHttp=null;
			try
			{	xmlHttp=new XMLHttpRequest();	}
			catch (e)
			{	try
				{	xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");  }
				catch (e)
				{	xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");	}
			}
			return xmlHttp;
		}
		
		function update()
		{
		  randomnum = Math.random();
		  randomnum = Math.floor(randomnum * 10000);
			xmlHttp=GetXmlHttpObject()
			xmlHttp.onreadystatechange=function()
			{
				if(xmlHttp.readyState==1)
				{
				  document.getElementById("loadergif").style.visibility = "visible";
				}
				
				if(xmlHttp.readyState==4)
				{
				  document.getElementById("loadergif").style.visibility = "hidden";
					document.getElementById("tempstats").src = "tempstats-img.php?"+randomnum;
				}
			}	
			xmlHttp.open("GET","tempstats-img.php?"+randomnum,true);
			xmlHttp.send(null);
			
			setTimeout(update,timeout);
		}
		
		setTimeout(update,timeout);
  </script>
  <div id="loadergif" style="position:absolute; font-family:Arial; font-size:11px; font-weight:bold; color:#00137F; visibility:hidden;">
  <img style="border:0; float:left; margin-right:5px;" src="images/loading.gif" /> Updating...</div>
  <span id="tempstats-container"><img id="tempstats" onclick="update();" style="border:0;" src="tempstats-img.php"></span>
</div>